package work.huangxin.share.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import work.huangxin.share.domain.other.ArticleMessage;
import work.huangxin.share.domain.other.CommentMessage;
import work.huangxin.share.domain.other.NoticeMessage;
import work.huangxin.share.mapper.AdminArticleMapper;
import work.huangxin.share.mapper.ArticleMessageMapper;
import work.huangxin.share.mapper.NoticeMessageMapper;
import work.huangxin.share.service.AdminArticleService;

import javax.annotation.Resource;
import java.util.List;

/**
* @author 钟声浩
* @date 2023/4/1 15:53
*/
@Service
public class AdminArticleServiceImpl implements AdminArticleService {

    @Resource
    private AdminArticleMapper adminArticleMapper;


    //后台分页查询文章
    @Override
    public PageInfo<ArticleMessage> selectPageArticleList(ArticleMessage articleMessage, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ArticleMessage> articleMessageList = adminArticleMapper.selectPageArticleList(articleMessage);
        return PageInfo.of(articleMessageList);
    }

    //后台分页查询所有评论
    @Override
    public PageInfo<CommentMessage> selectPageCommentList(CommentMessage commentMessage, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<CommentMessage> commentMessageList = adminArticleMapper.selectPageCommentList(commentMessage);
        return PageInfo.of(commentMessageList);
    }


}
